package cards.dao;


import java.util.Date;
import java.util.List;

import cards.entity.CardActivity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface CardActivityDao {
    String TABLE_NAME = "card_activity";
    String INSERT_FIELDS = "title,publicity_picture,start_time,end_time,card_type," +
            "        card_picture1,card_picture2,card_picture3,card_picture4,card_picture5,collection_rules," +
            "            card_probability1,card_probability2,card_probability3,card_probability4,card_probability5," +
            "                create_time,status,participants,full_collectors";
    String SELECT_FIELDS = "id, title,publicity_picture,start_time,end_time,card_type," +
            "        card_picture1,card_picture2,card_picture3,card_picture4,card_picture5,collection_rules," +
            "            card_probability1,card_probability2,card_probability3,card_probability4,card_probability5," +
            "                create_time,status,participants,full_collectors";

    int addCardActivity(CardActivity cardActivity);
    int updateTitle(@Param("id") Long id, @Param("title") String title);
    int updatePublicityPicture(@Param("id") Long id, @Param("publicity_picture") String publicity_picture);
    int updateStartTime(@Param("id") Long id, @Param("start_time") Date start_time);
    int updateEndTime(@Param("id") Long id, @Param("end_time") Date end_time);
    int updateCardType(@Param("id") Long id, @Param("card_type") String card_type);
    int updateCardPicture1(@Param("id") Long id, @Param("card_picture1") String card_picture1);
    int updateCardPicture2(@Param("id") Long id, @Param("card_picture2") String card_picture2);
    int updateCardPicture3(@Param("id") Long id, @Param("card_picture3") String card_picture3);
    int updateCardPicture4(@Param("id") Long id, @Param("card_picture4") String card_picture4);
    int updateCardPicture5(@Param("id") Long id, @Param("card_picture5") String card_picture5);
    int updateCollectionRules(@Param("id") Long id, @Param("collection_rules") String collection_rules);
    int updateCardProbability1(@Param("id") Long id, @Param("card_probability1") float card_probability1);
    int updateCardProbability2(@Param("id") Long id, @Param("card_probability2") float card_probability2);
    int updateCardProbability3(@Param("id") Long id, @Param("card_probability3") float card_probability3);
    int updateCardProbability4(@Param("id") Long id, @Param("card_probability4") float card_probability4);
    int updateCardProbability5(@Param("id") Long id, @Param("card_probability5") float card_probability5);
    int updateCreateTime(@Param("id") Long id, @Param("create_time") Date create_time);
    int updateStatus(@Param("id") Long id, @Param("status") int status);
    int updateParticipants(@Param("id") Long id, @Param("participants") int participants);
    int updateFullCollectors(@Param("id") Long id, @Param("full_collectors") int full_collectors);

    Long countCardActivity();
    List<CardActivity> findCardActivityByTitle(@Param("title") String title);
    CardActivity findCardActivityByExactTitle(@Param("title") String title);
    CardActivity findCardActivityById(@Param("id") Long id);
    List<CardActivity> findCardActivityByCreateTimeDesc();

}
